$(function () {
   $('.close_order').click(function () {
       var order_id=$(this).attr('data');
       layer.open({
           content: '您是否确认要取消订单？'
           ,btn: ['确认', '不了']
           ,yes: function(index){
                layer.close(index);
               edit_order(order_id, 'close_order');
           }
       });

   })

    $('.wuliu_order').click(function () {
        $('.other').toggle(100);

    })

    $('.yes_order').click(function () {
        var order_id=$(this).attr('data');
        layer.open({
            content: '您是否确认收货？'
            ,btn: ['确认', '还没']
            ,yes: function(index){
                layer.close(index);
                edit_order(order_id, 'get_order');
            }
        });

    })

    function edit_order(order_id,type) {
        $.ajax({
            type: "POST",
            url: "/user/order/edit_order.html",
            data: {
                order_id:order_id,
                type:type
            },
            dataType: "json",
            success: function (data) {
                layer.open({
                    content: data.msg
                    ,skin: 'msg'
                    ,time: 2 //2秒后自动关闭
                });
                if(data.code==1){
                    window.location.reload()
                }
            }
        })
    }
})